package async

import (
	"github.com/gin-gonic/gin"
	"log"
	"time"
)

func init() {
	r := gin.Default()
	// 异步
	r.GET("long_async", func(context *gin.Context) {
		copyContext := context.Copy()
		go func() {
			time.Sleep(3 * time.Second)
			log.Println("异步执行: " + copyContext.Request.URL.Path)
		}()
	})
	r.Run(":8000")
}
